//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    path: 'https://www.tuyaji.com.cn/wx-applet-cloudprint-h5-nest?dcyy_source=3cfa3050dd1ffe403326c73e4425cadb2e81148c7cc46623e0ddcc80943d5960',
    // 测试头部广告图片
    imgUrls: [
      'https://images.unsplash.com/photo-1551334787-21e6bd3ab135?w=640',
      'https://images.unsplash.com/photo-1551214012-84f95e060dee?w=640',
      'https://images.unsplash.com/photo-1551446591-142875a901a1?w=640'
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000
  },
  onLoad: function() {
    let that = this;
    wx.setStorageSync('dcyy_source', '3cfa3050dd1ffe403326c73e4425cadb2e81148c7cc46623e0ddcc80943d5960#/photoMenu');

  },

  //文档打印跳转
  // docPrint: function(e) {
  //   wx.navigateTo({
  //     url: './' + e.target.dataset.page + '/' + e.target.dataset.page
  //   })

  // },

  //页面跳转通用方法
  pageSkipping: function(e) {
    console.log(e.target.dataset.page)
    wx.navigateTo({
      url: './' + e.currentTarget.dataset.page + '/' + e.currentTarget.dataset.page
    })
  },





  choiceType(e) {
    var that = this
    wx.chooseImage({
      count: 1, // 默认9
      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
      success: function(res) {
        // 返回选定照片的本地文件路径列表，tempFilePath可以作为img标签的src属性显示图片
        var tempFilePaths = res.tempFilePaths
        console.log(tempFilePaths)
        // that.previewPic(tempFilePaths)
        wx.navigateTo({
          url: './' + e.currentTarget.dataset.page + '/' + e.currentTarget.dataset.page + '?path=' + tempFilePaths
        })
      }
    })
  },
  previewPic(urls) {
    wx.previewImage({
      current: '', // 当前显示图片的http链接
      urls: urls, // 需要预览的图片http链接列表
      success: function() {

      }
    })
  }
})